
enable_testing()

include(GoogleTest)

# testcase1 : hello world

add_executable(test-hello-world
        hello_world.cpp)

target_link_libraries(test-hello-world PRIVATE GTest::gtest GTest::gtest_main)

# testcase2 : base64

add_executable(test-base64 base64.cpp)

target_link_libraries(test-base64 PRIVATE GTest::gtest GTest::gtest_main crypto)

gtest_discover_tests(test-hello-world test-base64)

# testcase3 : rsa

add_executable(test-rsa rsa.cpp)

add_custom_command(
        TARGET test-rsa POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy
        "${PROJECT_SOURCE_DIR}/key_pair/public.pem"
        "${PROJECT_SOURCE_DIR}/key_pair/private.pem"
        $<TARGET_FILE_DIR:test-rsa>)

target_link_libraries(test-rsa PRIVATE GTest::gtest GTest::gtest_main crypto)

gtest_discover_tests(test-rsa)

# testcase4 : args

add_executable(test-args args.cpp)

target_link_libraries(test-args PRIVATE GTest::gtest GTest::gtest_main args)

gtest_discover_tests(test-args)